#ifndef MYMQTT_H
#define MYMQTT_H

#include <QWidget>
#include <qmqtt.h>
#include <QJsonParseError>
#include <QJsonValue>
#include <QJsonDocument>
#include <QJsonObject>
#include <QFile>
#include <QTimer>
#include <QTest>

namespace Ui {
class MyMqtt;
}

class MyMqtt : public QWidget
{
    Q_OBJECT

public:
    explicit MyMqtt(QWidget *parent = 0);
    QString rawdata;

    ~MyMqtt();

private slots:
    void doDataReceived(QMQTT::Message message);
    void doSubscribed(const QString& topic, const quint8 qos);
    void doConnected();  //MQTT连接成功
    void doDisConnected();//MQTT连接断开
    quint16 publish(QString data);
    void detectState();
    void mqttInit(QString ip,QString port);
    void cancelconnect();//主动断连

private:
    Ui::MyMqtt *ui;
    QMQTT::Client *client;

signals:
    void upsignal (QString data);
    void mqttstatesignalon();
    void mqttstatesignaloff();




};

#endif // MYMQTT
